﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Celine.Domain.Customers;
using Dukous.Dao.NHibernate;
using Dukous.Search;

namespace Celine.Dao.Customers.NHibernate
{
    public class CustomerDao : EntityDao<Customer, long>, ICustomerDao, ISearchSupport<Customer>
    {
        #region ISearchSupport<Customer> 成员

        public IList<Customer> SelectBySearch(ISearchContext context, out int totalCount)
        {
            totalCount = 100;

            DateTime createTimeMin = context.GetMinValue<DateTime>("CreateTime");
            DateTime? createTimeMax = context.GetMinValue<DateTime?>("CreateTime");
            string serialNumber = context.GetValue<string>("SerialNumber");

            SearchOrder searchOrder = context.GetOrder("SerialNumber");

            return new List<Customer>() 
            { 
                new Customer(){ Id = 1, Name = "matt fang", BirthDate = new DateTime(1984, 11, 18) },
                new Customer(){ Id = 2, Name = "celine zhu", BirthDate = new DateTime(1985, 11, 15) },
                new Customer(){ Id = 3, Name = "jack fang", BirthDate = new DateTime(2012, 11, 18) }
            };
        }

        #endregion
    }
}
